// 拿到input的值
function getInputValue() {

    let dbAddress = document.getElementsByClassName("Site")[0].value;
    let dbUsername = document.getElementsByClassName("UserName")[0].value;
    let dbPassword = document.getElementsByClassName("PassWord")[0].value;
    if (dbAddress == "" || dbUsername == "" || dbPassword == "") {
      alert("请输入完整信息！");
    } else {
      console.log(dbAddress);
      console.log(dbUsername);
      console.log(dbPassword);

      fetch("/api/test-connection", {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          address: dbAddress,
          username: dbUsername,
          password: dbPassword,
        }),
      })
        .then((response) => response.json())
        .then((data) => {
          alert(data.message);
        })
        .catch((error) => {
          console.error("Error:", error);
        });
    }

}